<%- include ("../public/page_header.html") %>

    <script type="text/javascript" src="/admin/bootstrap/js/bootstrap.js"></script>

    <link href="https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css" rel="stylesheet"
        type="text/css" />
    <script type="text/javascript"
        src="https://cdn.jsdelivr.net/npm/froala-editor@latest/js/froala_editor.pkgd.min.js"></script>

    <script type="text/javascript" src="/wysiwyg-editor/js/languages/zh_cn.js"></script>


    <style>
        .nav-tabs {
            background: #eee;
        }

        .tab-content {
            position: relative;
            top: -12px;
            background: #fff;
            padding: 20px;
        }

        .articel_content {
            border: 1px solid #eee;
            /* margin-bottom: 20px;     */
        }

        .nav-tabs li {
            padding: 0px 5px;
        }
    </style>
    <div class="panel panel-default">
        <div class="panel-heading">
            修改内容
        </div>
        <div class="panel-body">
            <div class="table-responsive input-form articel_content">
                <form action="/<%=adminPath%>/article/doEdit" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="<%=list._id%>" />
                    <ul id="myTab" class="nav nav-tabs">

                        <li class="active">
                            <a href="#index" data-toggle="tab">基本设置</a>
                        </li>
                        <li>
                            <a href="#info" data-toggle="tab">
                                内容详情
                            </a>
                        </li>
                        <li>
                            <a href="#seo" data-toggle="tab">
                                Seo设置
                            </a>
                        </li>
                    </ul>
                    <div id="myTabContent" class="tab-content">

                        <div class="tab-pane fade  in active" id="index">
                            <ul>

                                <li>
                                    <span>所属分类: </span>
                                    <select name="cid" id="cid">
                                        <%for(var i=0;i<cateList.length;i++){%>
                                            <option value="<%=cateList[i]._id%>" <%if(list.cid.toString()==cateList[i]._id.toString()){%> selected <%}%>>
                                                <%=cateList[i].title%>
                                            </option>
                                            <%for(var j=0;j<cateList[i].items.length;j++){%>
                                                <option value="<%=cateList[i].items[j]._id%>" <%if(list.cid.toString()==cateList[i].items[j]._id.toString()){%> selected <%}%>> --
                                                    <%=cateList[i].items[j].title%>
                                                </option>
                                                <%}%>
                                                    <%}%>
                                    </select>
                                </li>
                                <li> <span>内容标题: </span> <input type="text" name="title" value="<%=list.title%>" /></li>

                                <li> <span>封面图:</span>
                                    <input type="file" name="article_img" />
                                    <br>
                                    <span></span>
                                    <img src="/<%=list.article_img%>" width="80" />
                                </li>
                                <li> <span>作　　者: </span> <input type="text" name="author" value="<%=list.author%>" />
                                </li>
                                <li> <span>排　　序: </span> <input type="text" name="sort" value="<%=list.sort%>" /></li>
                                <li> <span>状　　态: </span>
                                    <input type="radio" name="status" <% if (list.status==1){%> checked <%}%> value="1"
                                        id="a" /> <label for="a">显示</label>
                                        <input type="radio" name="status" <% if (list.status==0){%> checked <%}%>
                                            value="0" id="b" /><label for="b">隐藏</label>
                                </li>

                                <li> <span>加入推荐:</span>　
                                    <input type="checkbox" value="1" name="is_best" <% if (list.is_best==1){%> checked
                                    <%}%>/> 精品
                                        <input type="checkbox" value="1" name="is_hot" <% if (list.is_hot==1){%> checked
                                        <%}%>/> 热门
                                </li>
                                <li>
                                    <br />
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </li>

                            </ul>
                        </div>
                        <div class="tab-pane fade" id="info">
                            <textarea name="content" id="content" cols="30" rows="10"><%=list.content%></textarea>
                        </div>
                        <div class="tab-pane fade" id="seo">
                            <ul>
                                <li> <span>关键词: </span> <input type="text" name="keywords" value="<%=list.keywords%>" />
                                </li>
                                <li> <span>Seo描述:</span> <textarea name="description" id="description" cols="84"
                                        rows="4"><%=list.description%></textarea>
                                </li>
                            </ul>
                        </div>

                    </div>

                </form>
            </div>
        </div>


    </div>

    <script>


        new FroalaEditor('#content', {
            height: 260,
            language: 'zh_cn',
            imageUploadURL: '/<%=adminPath%>/article/doUpload',
        });

    </script>
    </body>

    </html>